home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 4 / Apprentice-Release4.iso / Languages / MPW Oberon 2.1168 / OInterfaces / TranslationExtensions.mod < prev    next >
Encoding:
Text File  |  1995-08-10  |  6.1 KB  |  161 lines  |  [TEXT/MPS ]

  1. (*
  2.      File:        TranslationExtensions.mod
  3.  
  4.      Contains:    Macintosh Easy Open Translation Extension Interfaces.
  5.  
  6.      Version:    Technology:    Macintosh Easy Open 1.1
  7.                  Package:    Universal Interfaces 2.0 in “MPW Latest” on ETO #17
  8.  
  9.      Copyright:    © 1984-1995 by Apple Computer, Inc.
  10.                  All rights reserved.
  11.  
  12.      Bugs?:        If you find a problem with this file, use the Apple Bug Reporter
  13.                  stack.  Include the file and version information (from above)
  14.                  in the problem description and send to:
  15.                      Internet:    apple.bugs.applelink.apple.com
  16.                      AppleLink:    APPLE.BUGS
  17.  
  18. *)
  19.  
  20. (*$TAGS-*)
  21. (*$CALLING PASCAL*)
  22. MODULE TranslationExtensions;
  23.  
  24. IMPORT SYSTEM, Types, Memory, Quickdraw, Files, Components;
  25.  
  26. (* $PUSH*)
  27. (* $ALIGN MAC68K*)
  28. (* $LibExport+*)
  29.  
  30. CONST
  31.     kSupportsFileTranslation*    = 1;
  32.     kSupportsScrapTranslation*    = 2;
  33.     kTranslatorCanGenerateFilename* = 4;
  34.  
  35.     
  36. TYPE
  37.     FileType* = Types.OSType;
  38.  
  39.     ScrapType* = Types.ResType;
  40.  
  41.     TranslationAttributes* = LONGINT;
  42.  
  43.  
  44. CONST
  45.     taDstDocNeedsResourceFork*    = 1;
  46.     taDstIsAppTranslation*        = 2;
  47.  
  48.  
  49. TYPE
  50.     FileTypeSpec* = RECORD
  51.         format*:                    FileType;
  52.         hint*:                    LONGINT;
  53.         flags*:                    TranslationAttributes;                    (* taDstDocNeedsResourceFork, taDstIsAppTranslation*)
  54.         catInfoType*:            Types.OSType;
  55.         catInfoCreator*:            Types.OSType;
  56.     END;
  57.  
  58.     FileTranslationList* = RECORD
  59.         modDate*:                LONGINT;
  60.         groupCount*:                LONGINT;
  61.         (*     unsigned long    group1SrcCount;*)
  62.         (*     unsigned long    group1SrcEntrySize* = sizeof(FileTypeSpec);*)
  63.         (*  FileTypeSpec    group1SrcTypes[group1SrcCount]*)
  64.         (*  unsigned long    group1DstCount;*)
  65.         (*  unsigned long    group1DstEntrySize* = sizeof(FileTypeSpec);*)
  66.         (*  FileTypeSpec    group1DstTypes[group1DstCount]*)
  67.     END;
  68.  
  69.     FileTranslationListPtr* = POINTER TO FileTranslationList;
  70.     FileTranslationListHandle* = HANDLE TO FileTranslationList (*ΔΔ POINTER TO FileTranslationListPtr*);
  71.  
  72.     ScrapTypeSpec* = RECORD
  73.         format*:                    ScrapType;
  74.         hint*:                    LONGINT;
  75.     END;
  76.  
  77.     ScrapTranslationList* = RECORD
  78.         modDate*:                LONGINT;
  79.         groupCount*:                LONGINT;
  80.         (*     unsigned long        group1SrcCount;*)
  81.         (*     unsigned long        group1SrcEntrySize* = sizeof(ScrapTypeSpec);*)
  82.         (*  ScrapTypeSpec        group1SrcTypes[group1SrcCount]*)
  83.         (*  unsigned long        group1DstCount;*)
  84.         (*     unsigned long        group1DstEntrySize* = sizeof(ScrapTypeSpec);*)
  85.         (*  ScrapTypeSpec        group1DstTypes[group1DstCount]*)
  86.     END;
  87.  
  88.     ScrapTranslationListPtr* = POINTER TO ScrapTranslationList;
  89.     ScrapTranslationListHandle* = HANDLE TO ScrapTranslationList (*ΔΔ POINTER TO ScrapTranslationListPtr*);
  90.  
  91. (* definition of callbacks to update progress dialog*)
  92.     TranslationRefNum* = LONGINT;
  93.  
  94. (*****************************************************************************************
  95. *
  96. * This routine sets the advertisement in the top half of the progress dialog.
  97. * It is called once at the beginning of your DoTranslateFile routine.
  98. *
  99. * Enter:    refNum            Translation reference supplied to DoTranslateFile.
  100. *            advertisement    A handle to the picture to display.  This must be non-purgable.
  101. *                            Before returning from DoTranslateFile, you should dispose
  102. *                            of the memory.  (Normally, it is in the temp translation heap
  103. *                            so it is cleaned up for you.)
  104. *
  105. * Exit:    returns            noErr, paramErr, or memFullErr
  106. *)
  107.  
  108. PROCEDURE SetTranslationAdvertisement*(refNum: TranslationRefNum; advertisement: Quickdraw.PicHandle): Types.OSErr;
  109.     (*$IF NOT GENERATINGCFM*)
  110.     INLINE PASCAL $7002, $ABFC;
  111.     (*$END*)
  112. (*****************************************************************************************
  113. *
  114. * This routine updates the progress bar in the progress dialog.
  115. * It is called repeatedly from within your DoTranslateFile routine.
  116. * It should be called often, so that the user will get feedback if he tries to cancel.
  117. *
  118. * Enter:    refNum        translation reference supplied to DoTranslateFile.
  119. *            progress    percent complete (0-100)
  120. *
  121. * Exit:        canceled    TRUE if the user clicked the Cancel button, FALSE otherwise
  122. *            returns        noErr, paramErr, or memFullErr
  123. *)
  124. PROCEDURE UpdateTranslationProgress*(refNum: TranslationRefNum; percentDone: INTEGER; VAR canceled: BOOLEAN): Types.OSErr;
  125.     (*$IF NOT GENERATINGCFM*)
  126.     INLINE PASCAL $7001, $ABFC;
  127.     (*$END*)
  128. (* ComponentMgr selectors for routines*)
  129.  
  130. CONST
  131.     kTranslateGetFileTranslationList* = 0;                        (* component selectors*)
  132.     kTranslateIdentifyFile*        = 1;
  133.     kTranslateTranslateFile*        = 2;
  134.     kTranslateGetTranslatedFilename* = 3;
  135.     kTranslateGetScrapTranslationList* = 10;                        (* skip to scrap routines*)
  136.     kTranslateIdentifyScrap*        = 11;
  137.     kTranslateTranslateScrap*    = 12;
  138.  
  139. (* Routines to implment in a file translation extension*)
  140. TYPE
  141.     DoGetFileTranslationListProcPtr* = (*ΔΔ Types.ProcPtr;*) PROCEDURE (self: Components.ComponentInstance; translationList: FileTranslationListHandle): Components.ComponentResult;
  142.  
  143.     DoIdentifyFileProcPtr* = (*ΔΔ Types.ProcPtr;*) PROCEDURE (self: Components.ComponentInstance; (*CONST*)VAR theDocument: Files.FSSpec; VAR docType: FileType): Components.ComponentResult;
  144.  
  145.     DoTranslateFileProcPtr* = (*ΔΔ Types.ProcPtr;*) PROCEDURE (self: Components.ComponentInstance; refNum: TranslationRefNum; (*CONST*)VAR sourceDocument: Files.FSSpec; srcType: FileType; srcTypeHint: LONGINT; (*CONST*)VAR dstDoc: Files.FSSpec; dstType: FileType; dstTypeHint: LONGINT): Components.ComponentResult;
  146.  
  147.     DoGetTranslatedFilenameProcPtr* = (*ΔΔ Types.ProcPtr;*) PROCEDURE (self: Components.ComponentInstance; dstType: FileType; dstTypeHint: LONGINT; VAR theDocument: Files.FSSpec): Components.ComponentResult;
  148.  
  149. (* Routine to implement in a scrap translation extension*)
  150.     DoGetScrapTranslationListProcPtr* = (*ΔΔ Types.ProcPtr;*) PROCEDURE (self: Components.ComponentInstance; list: ScrapTranslationListHandle): Components.ComponentResult;
  151.  
  152.     DoIdentifyScrapProcPtr* = (*ΔΔ Types.ProcPtr;*) PROCEDURE (self: Components.ComponentInstance; dataPtr: (*ΔΔUNIVΔΔ*) Types.Ptr; dataLength: Memory.Size; VAR dataFormat: ScrapType): Components.ComponentResult;
  153.  
  154.     DoTranslateScrapProcPtr* = (*ΔΔ Types.ProcPtr;*) PROCEDURE (self: Components.ComponentInstance; refNum: TranslationRefNum; srcDataPtr: (*ΔΔUNIVΔΔ*) Types.Ptr; srcDataLength: Memory.Size; srcType: ScrapType; srcTypeHint: LONGINT; dstData: Types.Handle; dstType: ScrapType; dstTypeHint: LONGINT): Components.ComponentResult;
  155.  
  156.  
  157. (* $ALIGN RESET*)
  158. (* $POP*)
  159.  
  160.  END TranslationExtensions.
  161.